package com.ishopping.api.manage.service;

import com.ishopping.api.manage.entity.UserRole;
import com.ishopping.common.core.base.service.IBaseService;

import java.util.List;

public interface IUserRoleService extends IBaseService<UserRole> {
    /**
     * 通过userId获取用户角色
     * @param userId
     * @return List<Long>
     */
    List<UserRole> findUserRolesByUserId(Long userId);

    /**
     * 更新用户关联的角色
     * @param userId
     * @param newRoleList
     * @return int
     */
    int save(Long userId, List<Long> newRoleList);

    /**
     * 通过userId删除其关联的角色
     * @param userId
     * @return int
     */
    int deleteByUserId(Long userId);

    /**
     * 批量插入用户关联的角色
     * @param newRoleList
     * @param userId
     * @return int
     */
    int batchInsert(Long userId, List<Long> newRoleList);
}